// ProcessingWnd.cpp : implementation file
//

#include "stdafx.h"
#include "ExamClient.h"
#include "ProcessingWnd.h"


// CProcessingWnd dialog

IMPLEMENT_DYNAMIC(CProcessingWnd, CDialog)

CProcessingWnd::CProcessingWnd(CWnd* pParent /*=NULL*/)
    : CDialog(CProcessingWnd::IDD, pParent)
    , m_initialized(FALSE, TRUE)
{
    m_initialized.ResetEvent();
}

CProcessingWnd::~CProcessingWnd()
{
}

void CProcessingWnd::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_MESSAGE, m_processingMessage);
}


BEGIN_MESSAGE_MAP(CProcessingWnd, CDialog)
    ON_MESSAGE(UM_PROCESS_FINISHED, &CProcessingWnd::OnProcessFinished)
    ON_MESSAGE(UM_SET_PROCESSING_TEXT, &CProcessingWnd::OnSetProcessingText)
END_MESSAGE_MAP()


// CProcessingWnd message handlers

BOOL CProcessingWnd::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO:  Add extra initialization here
    m_processingMessage.SetWindowText(m_initialMessage);
    m_initialized.SetEvent();

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}

void CProcessingWnd::OnOK()
{
    // TODO: Add your specialized code here and/or call the base class

    //CDialog::OnOK();
}

void CProcessingWnd::OnCancel()
{
    // TODO: Add your specialized code here and/or call the base class

    //CDialog::OnCancel();
}

LRESULT CProcessingWnd::OnSetProcessingText(WPARAM wParam,LPARAM lParam)
{
    m_processingMessage.SetWindowText((LPCTSTR)lParam);
    return 0;
}

LRESULT CProcessingWnd::OnProcessFinished(WPARAM wParam,LPARAM lParam)
{
    CDialog::OnOK();
    return 0;
}
